/**
 * AgentBoot.java		26/06/2009
 */
package org.jopris;

import java.lang.instrument.Instrumentation;

/**
 * @author Guy Nir
 * @version 1.00
 */
public final class AgentBoot {

	private static Instrumentation instrumentation;

	/**
	 * Pre-main callback for agent. Called before application's
	 * <code>main</code> method is executed.
	 * 
	 * @param agentArguments
	 *            Agent arguments as passed on the <i>-agent:</i> parameter.
	 * 
	 * @param inst
	 *            Instrumentation API.
	 */
	public static void premain(String agentArguments, Instrumentation inst) {

		// Keep a reference to the instrumentation API.
		instrumentation = inst;

		// Add a new class-introspector for newly created (or retransformed)
		// classes.
		instrumentation.addTransformer(new ClassIntrospector(new AnnotatedFieldsRepository()), true);

	}

}
